using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace FluentTags
{

    public class BTag : Tag<BTag>
    {
        public BTag() : base("b"){}
        
        public BTag(string text) : this()
        {
            Controls.Add(new LiteralControl(text));
        }

        public BTag(object value) : this()
        {
            Controls.Add(new LiteralControl(SafeString(value)));
        }
        
        
        public BTag(Control control) : this()
        {
            Controls.Add(control);
        }
        
        
        
        
        public ATag<BTag> A()
        {
            var ctrl = new ATag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag A(ATag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public ATag<BTag> A(string text)
        {
            var ctrl = new ATag<BTag>(this);
            Controls.Add(ctrl);
            LiteralControl lc = new LiteralControl(text);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public ATag<BTag> A(Control control)
        {
            var ctrl = new ATag<BTag>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public ATag<BTag> A(object value)
        {
            return A(SafeString(value));
        }
        
        public BTag<BTag> B()
        {
            var ctrl = new BTag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag B(BTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public BTag<BTag> B(string text)
        {
            var ctrl = new BTag<BTag>(this);
            Controls.Add(ctrl);
            LiteralControl lc = new LiteralControl(text);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public BTag<BTag> B(Control control)
        {
            var ctrl = new BTag<BTag>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public BTag<BTag> B(object value)
        {
            return B(SafeString(value));
        }
        
        public BRTag<BTag> BR()
        {
            var ctrl = new BRTag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag BR(BRTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public EMTag<BTag> EM()
        {
            var ctrl = new EMTag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag EM(EMTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public EMTag<BTag> EM(string text)
        {
            var ctrl = new EMTag<BTag>(this);
            Controls.Add(ctrl);
            LiteralControl lc = new LiteralControl(text);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public EMTag<BTag> EM(Control control)
        {
            var ctrl = new EMTag<BTag>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public EMTag<BTag> EM(object value)
        {
            return EM(SafeString(value));
        }
        
        public ITag<BTag> I()
        {
            var ctrl = new ITag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag I(ITag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public ITag<BTag> I(string text)
        {
            var ctrl = new ITag<BTag>(this);
            Controls.Add(ctrl);
            LiteralControl lc = new LiteralControl(text);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public ITag<BTag> I(Control control)
        {
            var ctrl = new ITag<BTag>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public ITag<BTag> I(object value)
        {
            return I(SafeString(value));
        }
        
        public ImgTag<BTag> Img()
        {
            var ctrl = new ImgTag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag Img(ImgTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public SpanTag<BTag> Span()
        {
            var ctrl = new SpanTag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag Span(SpanTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public SpanTag<BTag> Span(string text)
        {
            var ctrl = new SpanTag<BTag>(this);
            Controls.Add(ctrl);
            LiteralControl lc = new LiteralControl(text);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public SpanTag<BTag> Span(Control control)
        {
            var ctrl = new SpanTag<BTag>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public SpanTag<BTag> Span(object value)
        {
            return Span(SafeString(value));
        }
        
        public StrongTag<BTag> Strong()
        {
            var ctrl = new StrongTag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag Strong(StrongTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public StrongTag<BTag> Strong(string text)
        {
            var ctrl = new StrongTag<BTag>(this);
            Controls.Add(ctrl);
            LiteralControl lc = new LiteralControl(text);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public StrongTag<BTag> Strong(Control control)
        {
            var ctrl = new StrongTag<BTag>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public StrongTag<BTag> Strong(object value)
        {
            return Strong(SafeString(value));
        }
        
        public SubTag<BTag> Sub()
        {
            var ctrl = new SubTag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag Sub(SubTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public SubTag<BTag> Sub(string text)
        {
            var ctrl = new SubTag<BTag>(this);
            Controls.Add(ctrl);
            LiteralControl lc = new LiteralControl(text);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public SubTag<BTag> Sub(Control control)
        {
            var ctrl = new SubTag<BTag>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public SubTag<BTag> Sub(object value)
        {
            return Sub(SafeString(value));
        }
        
        public SupTag<BTag> Sup()
        {
            var ctrl = new SupTag<BTag>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag Sup(SupTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public SupTag<BTag> Sup(string text)
        {
            var ctrl = new SupTag<BTag>(this);
            Controls.Add(ctrl);
            LiteralControl lc = new LiteralControl(text);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public SupTag<BTag> Sup(Control control)
        {
            var ctrl = new SupTag<BTag>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public SupTag<BTag> Sup(object value)
        {
            return Sup(SafeString(value));
        }
        
        
        public BTag Text(string text)
        {
            Controls.Add(new LiteralControl(text));
            return this;
        }

        public BTag Text(object value)
        {
            Controls.Add(new LiteralControl(SafeString(value)));
            return this;
        }
        
    }

    public class BTag<ParentType> : ChildTag<BTag<ParentType>, ParentType>
        where ParentType : HtmlGenericControl
    {
        public BTag(ParentType parent) : base("b", parent) { }

        
        
        
        public ATag<BTag<ParentType>> A()
        {
            var ctrl = new ATag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> A(ATag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public ATag<BTag<ParentType>> A(string text)
        {
            var ctrl = new ATag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(text);
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public ATag<BTag<ParentType>> A(Control control)
        {
            var ctrl = new ATag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public ATag<BTag<ParentType>> A(object value)
        {
            var ctrl = new ATag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(SafeString(value));
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            return ctrl;
        }
        
        public BTag<BTag<ParentType>> B()
        {
            var ctrl = new BTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> B(BTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public BTag<BTag<ParentType>> B(string text)
        {
            var ctrl = new BTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(text);
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public BTag<BTag<ParentType>> B(Control control)
        {
            var ctrl = new BTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public BTag<BTag<ParentType>> B(object value)
        {
            var ctrl = new BTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(SafeString(value));
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            return ctrl;
        }
        
        public BRTag<BTag<ParentType>> BR()
        {
            var ctrl = new BRTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> BR(BRTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public EMTag<BTag<ParentType>> EM()
        {
            var ctrl = new EMTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> EM(EMTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public EMTag<BTag<ParentType>> EM(string text)
        {
            var ctrl = new EMTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(text);
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public EMTag<BTag<ParentType>> EM(Control control)
        {
            var ctrl = new EMTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public EMTag<BTag<ParentType>> EM(object value)
        {
            var ctrl = new EMTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(SafeString(value));
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            return ctrl;
        }
        
        public ITag<BTag<ParentType>> I()
        {
            var ctrl = new ITag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> I(ITag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public ITag<BTag<ParentType>> I(string text)
        {
            var ctrl = new ITag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(text);
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public ITag<BTag<ParentType>> I(Control control)
        {
            var ctrl = new ITag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public ITag<BTag<ParentType>> I(object value)
        {
            var ctrl = new ITag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(SafeString(value));
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            return ctrl;
        }
        
        public ImgTag<BTag<ParentType>> Img()
        {
            var ctrl = new ImgTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> Img(ImgTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public SpanTag<BTag<ParentType>> Span()
        {
            var ctrl = new SpanTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> Span(SpanTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public SpanTag<BTag<ParentType>> Span(string text)
        {
            var ctrl = new SpanTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(text);
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public SpanTag<BTag<ParentType>> Span(Control control)
        {
            var ctrl = new SpanTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public SpanTag<BTag<ParentType>> Span(object value)
        {
            var ctrl = new SpanTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(SafeString(value));
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            return ctrl;
        }
        
        public StrongTag<BTag<ParentType>> Strong()
        {
            var ctrl = new StrongTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> Strong(StrongTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public StrongTag<BTag<ParentType>> Strong(string text)
        {
            var ctrl = new StrongTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(text);
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public StrongTag<BTag<ParentType>> Strong(Control control)
        {
            var ctrl = new StrongTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public StrongTag<BTag<ParentType>> Strong(object value)
        {
            var ctrl = new StrongTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(SafeString(value));
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            return ctrl;
        }
        
        public SubTag<BTag<ParentType>> Sub()
        {
            var ctrl = new SubTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> Sub(SubTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public SubTag<BTag<ParentType>> Sub(string text)
        {
            var ctrl = new SubTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(text);
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public SubTag<BTag<ParentType>> Sub(Control control)
        {
            var ctrl = new SubTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public SubTag<BTag<ParentType>> Sub(object value)
        {
            var ctrl = new SubTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(SafeString(value));
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            return ctrl;
        }
        
        public SupTag<BTag<ParentType>> Sup()
        {
            var ctrl = new SupTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            return ctrl;
        }

        public BTag<ParentType> Sup(SupTag child)
        {
            Controls.Add(child);
            return this;
        }
        
        public SupTag<BTag<ParentType>> Sup(string text)
        {
            var ctrl = new SupTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(text);
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            
            return ctrl;
        }

        public SupTag<BTag<ParentType>> Sup(Control control)
        {
            var ctrl = new SupTag<BTag<ParentType>>(this);
            Controls.Add(ctrl);
            ctrl.Controls.Add(control);
            
            return ctrl;
        }

        public SupTag<BTag<ParentType>> Sup(object value)
        {
            var ctrl = new SupTag<BTag<ParentType>>(this);
            LiteralControl lc = new LiteralControl(SafeString(value));
            Controls.Add(ctrl);
            ctrl.Controls.Add(lc);
            return ctrl;
        }
        
        
        public BTag<ParentType> Text(string text)
        {
            Controls.Add(new LiteralControl(text));
            return this;
        }
        
        public BTag<ParentType> Text(object value)
        {
            Controls.Add(new LiteralControl(SafeString(value)));
            return this;
        }
        
        
    }
}